3.150 \(\int \frac {(d+e x) (f+g x+h x^2)}{a+b x+c x^2} \, dx\)

Optimal. Leaf size=177 \[ \frac {\log \left (a+b x+c x^2\right ) \left (-c (a e h+b d h+b e g)+b^2 e h+c^2 (d g+e f)\right )}{2 c^3}-\frac {\tanh ^{-1}\left (\frac {b+2 c x}{\sqrt {b^2-4 a c}}\right ) \left (-c^2 (2 a d h+2 a e g+b d g+b e f)+b c (3 a e h+b d h+b e g)+b^3 (-e) h+2 c^3 d f\right )}{c^3 \sqrt {b^2-4 a c}}+\frac {x (-b e h+c d h+c e g)}{c^2}+\frac {e h x^2}{2 c} \]

[Out]

(-b*e*h+c*d*h+c*e*g)*x/c^2+1/2*e*h*x^2/c+1/2*(c^2*(d*g+e*f)+b^2*e*h-c*(a*e*h+b*d*h+b*e*g))*ln(c*x^2+b*x+a)/c^3
-(2*c^3*d*f-b^3*e*h-c^2*(2*a*d*h+2*a*e*g+b*d*g+b*e*f)+b*c*(3*a*e*h+b*d*h+b*e*g))*arctanh((2*c*x+b)/(-4*a*c+b^2
)^(1/2))/c^3/(-4*a*c+b^2)^(1/2)

________________________________________________________________________________________

Rubi [A]  time = 0.35, antiderivative size = 177, normalized size of antiderivative = 1.00, number of steps used = 6, number of rules used = 5, integrand size = 28, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.179, Rules used = {1628, 634, 618, 206, 628} \[ \frac {\log \left (a+b x+c x^2\right ) \left (-c (a e h+b d h+b e g)+b^2 e h+c^2 (d g+e f)\right )}{2 c^3}-\frac {\tanh ^{-1}\left (\frac {b+2 c x}{\sqrt {b^2-4 a c}}\right ) \left (-c^2 (2 a d h+2 a e g+b d g+b e f)+b c (3 a e h+b d h+b e g)+b^3 (-e) h+2 c^3 d f\right )}{c^3 \sqrt {b^2-4 a c}}+\frac {x (-b e h+c d h+c e g)}{c^2}+\frac {e h x^2}{2 c} \]

Antiderivative was successfully verified.

[In]

Int[((d + e*x)*(f + g*x + h*x^2))/(a + b*x + c*x^2),x]

[Out]

((c*e*g + c*d*h - b*e*h)*x)/c^2 + (e*h*x^2)/(2*c) - ((2*c^3*d*f - b^3*e*h - c^2*(b*e*f + b*d*g + 2*a*e*g + 2*a
*d*h) + b*c*(b*e*g + b*d*h + 3*a*e*h))*ArcTanh[(b + 2*c*x)/Sqrt[b^2 - 4*a*c]])/(c^3*Sqrt[b^2 - 4*a*c]) + ((c^2
*(e*f + d*g) + b^2*e*h - c*(b*e*g + b*d*h + a*e*h))*Log[a + b*x + c*x^2])/(2*c^3)

Rule 206

Int[((a_) + (b_.)*(x_)^2)^(-1), x_Symbol] :> Simp[(1*ArcTanh[(Rt[-b, 2]*x)/Rt[a, 2]])/(Rt[a, 2]*Rt[-b, 2]), x]
 /; FreeQ[{a, b}, x] && NegQ[a/b] && (GtQ[a, 0] || LtQ[b, 0])

Rule 618

Int[((a_.) + (b_.)*(x_) + (c_.)*(x_)^2)^(-1), x_Symbol] :> Dist[-2, Subst[Int[1/Simp[b^2 - 4*a*c - x^2, x], x]
, x, b + 2*c*x], x] /; FreeQ[{a, b, c}, x] && NeQ[b^2 - 4*a*c, 0]

Rule 628

Int[((d_) + (e_.)*(x_))/((a_.) + (b_.)*(x_) + (c_.)*(x_)^2), x_Symbol] :> Simp[(d*Log[RemoveContent[a + b*x +
c*x^2, x]])/b, x] /; FreeQ[{a, b, c, d, e}, x] && EqQ[2*c*d - b*e, 0]

Rule 634

Int[((d_.) + (e_.)*(x_))/((a_) + (b_.)*(x_) + (c_.)*(x_)^2), x_Symbol] :> Dist[(2*c*d - b*e)/(2*c), Int[1/(a +
 b*x + c*x^2), x], x] + Dist[e/(2*c), Int[(b + 2*c*x)/(a + b*x + c*x^2), x], x] /; FreeQ[{a, b, c, d, e}, x] &
& NeQ[2*c*d - b*e, 0] && NeQ[b^2 - 4*a*c, 0] &&  !NiceSqrtQ[b^2 - 4*a*c]

Rule 1628

Int[(Pq_)*((d_.) + (e_.)*(x_))^(m_.)*((a_.) + (b_.)*(x_) + (c_.)*(x_)^2)^(p_.), x_Symbol] :> Int[ExpandIntegra
nd[(d + e*x)^m*Pq*(a + b*x + c*x^2)^p, x], x] /; FreeQ[{a, b, c, d, e, m}, x] && PolyQ[Pq, x] && IGtQ[p, -2]

Rubi steps

\begin {align*} \int \frac {(d+e x) \left (f+g x+h x^2\right )}{a+b x+c x^2} \, dx &=\int \left (\frac {c e g+c d h-b e h}{c^2}+\frac {e h x}{c}+\frac {c^2 d f+a b e h-a c (e g+d h)+\left (c^2 (e f+d g)+b^2 e h-c (b e g+b d h+a e h)\right ) x}{c^2 \left (a+b x+c x^2\right )}\right ) \, dx\\ &=\frac {(c e g+c d h-b e h) x}{c^2}+\frac {e h x^2}{2 c}+\frac {\int \frac {c^2 d f+a b e h-a c (e g+d h)+\left (c^2 (e f+d g)+b^2 e h-c (b e g+b d h+a e h)\right ) x}{a+b x+c x^2} \, dx}{c^2}\\ &=\frac {(c e g+c d h-b e h) x}{c^2}+\frac {e h x^2}{2 c}+\frac {\left (c^2 (e f+d g)+b^2 e h-c (b e g+b d h+a e h)\right ) \int \frac {b+2 c x}{a+b x+c x^2} \, dx}{2 c^3}+\frac {\left (2 c^3 d f-b^3 e h-c^2 (b e f+b d g+2 a e g+2 a d h)+b c (b e g+b d h+3 a e h)\right ) \int \frac {1}{a+b x+c x^2} \, dx}{2 c^3}\\ &=\frac {(c e g+c d h-b e h) x}{c^2}+\frac {e h x^2}{2 c}+\frac {\left (c^2 (e f+d g)+b^2 e h-c (b e g+b d h+a e h)\right ) \log \left (a+b x+c x^2\right )}{2 c^3}-\frac {\left (2 c^3 d f-b^3 e h-c^2 (b e f+b d g+2 a e g+2 a d h)+b c (b e g+b d h+3 a e h)\right ) \operatorname {Subst}\left (\int \frac {1}{b^2-4 a c-x^2} \, dx,x,b+2 c x\right )}{c^3}\\ &=\frac {(c e g+c d h-b e h) x}{c^2}+\frac {e h x^2}{2 c}-\frac {\left (2 c^3 d f-b^3 e h-c^2 (b e f+b d g+2 a e g+2 a d h)+b c (b e g+b d h+3 a e h)\right ) \tanh ^{-1}\left (\frac {b+2 c x}{\sqrt {b^2-4 a c}}\right )}{c^3 \sqrt {b^2-4 a c}}+\frac {\left (c^2 (e f+d g)+b^2 e h-c (b e g+b d h+a e h)\right ) \log \left (a+b x+c x^2\right )}{2 c^3}\\ \end {align*}

________________________________________________________________________________________

Mathematica [A]  time = 0.20, size = 173, normalized size = 0.98 \[ \frac {\log (a+x (b+c x)) \left (-c (a e h+b d h+b e g)+b^2 e h+c^2 (d g+e f)\right )-\frac {2 \tan ^{-1}\left (\frac {b+2 c x}{\sqrt {4 a c-b^2}}\right ) \left (c^2 (2 a d h+2 a e g+b d g+b e f)-b c (3 a e h+b d h+b e g)+b^3 e h-2 c^3 d f\right )}{\sqrt {4 a c-b^2}}+2 c x (-b e h+c d h+c e g)+c^2 e h x^2}{2 c^3} \]

Antiderivative was successfully verified.

[In]

Integrate[((d + e*x)*(f + g*x + h*x^2))/(a + b*x + c*x^2),x]

[Out]

(2*c*(c*e*g + c*d*h - b*e*h)*x + c^2*e*h*x^2 - (2*(-2*c^3*d*f + b^3*e*h + c^2*(b*e*f + b*d*g + 2*a*e*g + 2*a*d
*h) - b*c*(b*e*g + b*d*h + 3*a*e*h))*ArcTan[(b + 2*c*x)/Sqrt[-b^2 + 4*a*c]])/Sqrt[-b^2 + 4*a*c] + (c^2*(e*f +
d*g) + b^2*e*h - c*(b*e*g + b*d*h + a*e*h))*Log[a + x*(b + c*x)])/(2*c^3)

________________________________________________________________________________________

fricas [A]  time = 0.93, size = 654, normalized size = 3.69 \[ \left [\frac {{\left (b^{2} c^{2} - 4 \, a c^{3}\right )} e h x^{2} + \sqrt {b^{2} - 4 \, a c} {\left ({\left (2 \, c^{3} d - b c^{2} e\right )} f - {\left (b c^{2} d - {\left (b^{2} c - 2 \, a c^{2}\right )} e\right )} g + {\left ({\left (b^{2} c - 2 \, a c^{2}\right )} d - {\left (b^{3} - 3 \, a b c\right )} e\right )} h\right )} \log \left (\frac {2 \, c^{2} x^{2} + 2 \, b c x + b^{2} - 2 \, a c - \sqrt {b^{2} - 4 \, a c} {\left (2 \, c x + b\right )}}{c x^{2} + b x + a}\right ) + 2 \, {\left ({\left (b^{2} c^{2} - 4 \, a c^{3}\right )} e g + {\left ({\left (b^{2} c^{2} - 4 \, a c^{3}\right )} d - {\left (b^{3} c - 4 \, a b c^{2}\right )} e\right )} h\right )} x + {\left ({\left (b^{2} c^{2} - 4 \, a c^{3}\right )} e f + {\left ({\left (b^{2} c^{2} - 4 \, a c^{3}\right )} d - {\left (b^{3} c - 4 \, a b c^{2}\right )} e\right )} g - {\left ({\left (b^{3} c - 4 \, a b c^{2}\right )} d - {\left (b^{4} - 5 \, a b^{2} c + 4 \, a^{2} c^{2}\right )} e\right )} h\right )} \log \left (c x^{2} + b x + a\right )}{2 \, {\left (b^{2} c^{3} - 4 \, a c^{4}\right )}}, \frac {{\left (b^{2} c^{2} - 4 \, a c^{3}\right )} e h x^{2} - 2 \, \sqrt {-b^{2} + 4 \, a c} {\left ({\left (2 \, c^{3} d - b c^{2} e\right )} f - {\left (b c^{2} d - {\left (b^{2} c - 2 \, a c^{2}\right )} e\right )} g + {\left ({\left (b^{2} c - 2 \, a c^{2}\right )} d - {\left (b^{3} - 3 \, a b c\right )} e\right )} h\right )} \arctan \left (-\frac {\sqrt {-b^{2} + 4 \, a c} {\left (2 \, c x + b\right )}}{b^{2} - 4 \, a c}\right ) + 2 \, {\left ({\left (b^{2} c^{2} - 4 \, a c^{3}\right )} e g + {\left ({\left (b^{2} c^{2} - 4 \, a c^{3}\right )} d - {\left (b^{3} c - 4 \, a b c^{2}\right )} e\right )} h\right )} x + {\left ({\left (b^{2} c^{2} - 4 \, a c^{3}\right )} e f + {\left ({\left (b^{2} c^{2} - 4 \, a c^{3}\right )} d - {\left (b^{3} c - 4 \, a b c^{2}\right )} e\right )} g - {\left ({\left (b^{3} c - 4 \, a b c^{2}\right )} d - {\left (b^{4} - 5 \, a b^{2} c + 4 \, a^{2} c^{2}\right )} e\right )} h\right )} \log \left (c x^{2} + b x + a\right )}{2 \, {\left (b^{2} c^{3} - 4 \, a c^{4}\right )}}\right ] \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((e*x+d)*(h*x^2+g*x+f)/(c*x^2+b*x+a),x, algorithm="fricas")

[Out]

[1/2*((b^2*c^2 - 4*a*c^3)*e*h*x^2 + sqrt(b^2 - 4*a*c)*((2*c^3*d - b*c^2*e)*f - (b*c^2*d - (b^2*c - 2*a*c^2)*e)
*g + ((b^2*c - 2*a*c^2)*d - (b^3 - 3*a*b*c)*e)*h)*log((2*c^2*x^2 + 2*b*c*x + b^2 - 2*a*c - sqrt(b^2 - 4*a*c)*(
2*c*x + b))/(c*x^2 + b*x + a)) + 2*((b^2*c^2 - 4*a*c^3)*e*g + ((b^2*c^2 - 4*a*c^3)*d - (b^3*c - 4*a*b*c^2)*e)*
h)*x + ((b^2*c^2 - 4*a*c^3)*e*f + ((b^2*c^2 - 4*a*c^3)*d - (b^3*c - 4*a*b*c^2)*e)*g - ((b^3*c - 4*a*b*c^2)*d -
 (b^4 - 5*a*b^2*c + 4*a^2*c^2)*e)*h)*log(c*x^2 + b*x + a))/(b^2*c^3 - 4*a*c^4), 1/2*((b^2*c^2 - 4*a*c^3)*e*h*x
^2 - 2*sqrt(-b^2 + 4*a*c)*((2*c^3*d - b*c^2*e)*f - (b*c^2*d - (b^2*c - 2*a*c^2)*e)*g + ((b^2*c - 2*a*c^2)*d -
(b^3 - 3*a*b*c)*e)*h)*arctan(-sqrt(-b^2 + 4*a*c)*(2*c*x + b)/(b^2 - 4*a*c)) + 2*((b^2*c^2 - 4*a*c^3)*e*g + ((b
^2*c^2 - 4*a*c^3)*d - (b^3*c - 4*a*b*c^2)*e)*h)*x + ((b^2*c^2 - 4*a*c^3)*e*f + ((b^2*c^2 - 4*a*c^3)*d - (b^3*c
 - 4*a*b*c^2)*e)*g - ((b^3*c - 4*a*b*c^2)*d - (b^4 - 5*a*b^2*c + 4*a^2*c^2)*e)*h)*log(c*x^2 + b*x + a))/(b^2*c
^3 - 4*a*c^4)]

________________________________________________________________________________________

giac [A]  time = 0.19, size = 201, normalized size = 1.14 \[ \frac {c h x^{2} e + 2 \, c d h x + 2 \, c g x e - 2 \, b h x e}{2 \, c^{2}} + \frac {{\left (c^{2} d g - b c d h + c^{2} f e - b c g e + b^{2} h e - a c h e\right )} \log \left (c x^{2} + b x + a\right )}{2 \, c^{3}} + \frac {{\left (2 \, c^{3} d f - b c^{2} d g + b^{2} c d h - 2 \, a c^{2} d h - b c^{2} f e + b^{2} c g e - 2 \, a c^{2} g e - b^{3} h e + 3 \, a b c h e\right )} \arctan \left (\frac {2 \, c x + b}{\sqrt {-b^{2} + 4 \, a c}}\right )}{\sqrt {-b^{2} + 4 \, a c} c^{3}} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((e*x+d)*(h*x^2+g*x+f)/(c*x^2+b*x+a),x, algorithm="giac")

[Out]

1/2*(c*h*x^2*e + 2*c*d*h*x + 2*c*g*x*e - 2*b*h*x*e)/c^2 + 1/2*(c^2*d*g - b*c*d*h + c^2*f*e - b*c*g*e + b^2*h*e
 - a*c*h*e)*log(c*x^2 + b*x + a)/c^3 + (2*c^3*d*f - b*c^2*d*g + b^2*c*d*h - 2*a*c^2*d*h - b*c^2*f*e + b^2*c*g*
e - 2*a*c^2*g*e - b^3*h*e + 3*a*b*c*h*e)*arctan((2*c*x + b)/sqrt(-b^2 + 4*a*c))/(sqrt(-b^2 + 4*a*c)*c^3)

________________________________________________________________________________________

maple [B]  time = 0.01, size = 510, normalized size = 2.88 \[ \frac {3 a b e h \arctan \left (\frac {2 c x +b}{\sqrt {4 a c -b^{2}}}\right )}{\sqrt {4 a c -b^{2}}\, c^{2}}-\frac {2 a d h \arctan \left (\frac {2 c x +b}{\sqrt {4 a c -b^{2}}}\right )}{\sqrt {4 a c -b^{2}}\, c}-\frac {2 a e g \arctan \left (\frac {2 c x +b}{\sqrt {4 a c -b^{2}}}\right )}{\sqrt {4 a c -b^{2}}\, c}-\frac {b^{3} e h \arctan \left (\frac {2 c x +b}{\sqrt {4 a c -b^{2}}}\right )}{\sqrt {4 a c -b^{2}}\, c^{3}}+\frac {b^{2} d h \arctan \left (\frac {2 c x +b}{\sqrt {4 a c -b^{2}}}\right )}{\sqrt {4 a c -b^{2}}\, c^{2}}+\frac {b^{2} e g \arctan \left (\frac {2 c x +b}{\sqrt {4 a c -b^{2}}}\right )}{\sqrt {4 a c -b^{2}}\, c^{2}}-\frac {b d g \arctan \left (\frac {2 c x +b}{\sqrt {4 a c -b^{2}}}\right )}{\sqrt {4 a c -b^{2}}\, c}-\frac {b e f \arctan \left (\frac {2 c x +b}{\sqrt {4 a c -b^{2}}}\right )}{\sqrt {4 a c -b^{2}}\, c}+\frac {e h \,x^{2}}{2 c}+\frac {2 d f \arctan \left (\frac {2 c x +b}{\sqrt {4 a c -b^{2}}}\right )}{\sqrt {4 a c -b^{2}}}-\frac {a e h \ln \left (c \,x^{2}+b x +a \right )}{2 c^{2}}+\frac {b^{2} e h \ln \left (c \,x^{2}+b x +a \right )}{2 c^{3}}-\frac {b d h \ln \left (c \,x^{2}+b x +a \right )}{2 c^{2}}-\frac {b e g \ln \left (c \,x^{2}+b x +a \right )}{2 c^{2}}-\frac {b e h x}{c^{2}}+\frac {d g \ln \left (c \,x^{2}+b x +a \right )}{2 c}+\frac {d h x}{c}+\frac {e f \ln \left (c \,x^{2}+b x +a \right )}{2 c}+\frac {e g x}{c} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

int((e*x+d)*(h*x^2+g*x+f)/(c*x^2+b*x+a),x)

[Out]

1/2*e*h*x^2/c-1/c^2*b*e*h*x+1/c*d*h*x+1/c*e*g*x-1/2/c^2*ln(c*x^2+b*x+a)*a*e*h+1/2/c^3*ln(c*x^2+b*x+a)*b^2*e*h-
1/2/c^2*ln(c*x^2+b*x+a)*b*d*h-1/2/c^2*ln(c*x^2+b*x+a)*b*e*g+1/2/c*ln(c*x^2+b*x+a)*d*g+1/2/c*ln(c*x^2+b*x+a)*e*
f+3/c^2/(4*a*c-b^2)^(1/2)*arctan((2*c*x+b)/(4*a*c-b^2)^(1/2))*a*b*e*h-2/c/(4*a*c-b^2)^(1/2)*arctan((2*c*x+b)/(
4*a*c-b^2)^(1/2))*a*d*h-2/c/(4*a*c-b^2)^(1/2)*arctan((2*c*x+b)/(4*a*c-b^2)^(1/2))*a*e*g+2/(4*a*c-b^2)^(1/2)*ar
ctan((2*c*x+b)/(4*a*c-b^2)^(1/2))*d*f-1/c^3/(4*a*c-b^2)^(1/2)*arctan((2*c*x+b)/(4*a*c-b^2)^(1/2))*b^3*e*h+1/c^
2/(4*a*c-b^2)^(1/2)*arctan((2*c*x+b)/(4*a*c-b^2)^(1/2))*b^2*d*h+1/c^2/(4*a*c-b^2)^(1/2)*arctan((2*c*x+b)/(4*a*
c-b^2)^(1/2))*b^2*e*g-1/c/(4*a*c-b^2)^(1/2)*arctan((2*c*x+b)/(4*a*c-b^2)^(1/2))*b*d*g-1/c/(4*a*c-b^2)^(1/2)*ar
ctan((2*c*x+b)/(4*a*c-b^2)^(1/2))*b*e*f

________________________________________________________________________________________

maxima [F(-2)]  time = 0.00, size = 0, normalized size = 0.00 \[ \text {Exception raised: ValueError} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((e*x+d)*(h*x^2+g*x+f)/(c*x^2+b*x+a),x, algorithm="maxima")

[Out]

Exception raised: ValueError >> Computation failed since Maxima requested additional constraints; using the 'a
ssume' command before evaluation *may* help (example of legal syntax is 'assume(4*a*c-b^2>0)', see `assume?` f
or more details)Is 4*a*c-b^2 positive or negative?

________________________________________________________________________________________

mupad [B]  time = 0.53, size = 273, normalized size = 1.54 \[ x\,\left (\frac {d\,h+e\,g}{c}-\frac {b\,e\,h}{c^2}\right )-\frac {\ln \left (c\,x^2+b\,x+a\right )\,\left (b^4\,e\,h-4\,a\,c^3\,d\,g-4\,a\,c^3\,e\,f-b^3\,c\,d\,h-b^3\,c\,e\,g+b^2\,c^2\,d\,g+b^2\,c^2\,e\,f+4\,a^2\,c^2\,e\,h+4\,a\,b\,c^2\,d\,h+4\,a\,b\,c^2\,e\,g-5\,a\,b^2\,c\,e\,h\right )}{2\,\left (4\,a\,c^4-b^2\,c^3\right )}-\frac {\mathrm {atan}\left (\frac {b}{\sqrt {4\,a\,c-b^2}}+\frac {2\,c\,x}{\sqrt {4\,a\,c-b^2}}\right )\,\left (b^3\,e\,h-2\,c^3\,d\,f+2\,a\,c^2\,d\,h+2\,a\,c^2\,e\,g+b\,c^2\,d\,g+b\,c^2\,e\,f-b^2\,c\,d\,h-b^2\,c\,e\,g-3\,a\,b\,c\,e\,h\right )}{c^3\,\sqrt {4\,a\,c-b^2}}+\frac {e\,h\,x^2}{2\,c} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

int(((d + e*x)*(f + g*x + h*x^2))/(a + b*x + c*x^2),x)

[Out]

x*((d*h + e*g)/c - (b*e*h)/c^2) - (log(a + b*x + c*x^2)*(b^4*e*h - 4*a*c^3*d*g - 4*a*c^3*e*f - b^3*c*d*h - b^3
*c*e*g + b^2*c^2*d*g + b^2*c^2*e*f + 4*a^2*c^2*e*h + 4*a*b*c^2*d*h + 4*a*b*c^2*e*g - 5*a*b^2*c*e*h))/(2*(4*a*c
^4 - b^2*c^3)) - (atan(b/(4*a*c - b^2)^(1/2) + (2*c*x)/(4*a*c - b^2)^(1/2))*(b^3*e*h - 2*c^3*d*f + 2*a*c^2*d*h
 + 2*a*c^2*e*g + b*c^2*d*g + b*c^2*e*f - b^2*c*d*h - b^2*c*e*g - 3*a*b*c*e*h))/(c^3*(4*a*c - b^2)^(1/2)) + (e*
h*x^2)/(2*c)

________________________________________________________________________________________

sympy [B]  time = 14.46, size = 1265, normalized size = 7.15 \[ x \left (- \frac {b e h}{c^{2}} + \frac {d h}{c} + \frac {e g}{c}\right ) + \left (- \frac {\sqrt {- 4 a c + b^{2}} \left (3 a b c e h - 2 a c^{2} d h - 2 a c^{2} e g - b^{3} e h + b^{2} c d h + b^{2} c e g - b c^{2} d g - b c^{2} e f + 2 c^{3} d f\right )}{2 c^{3} \left (4 a c - b^{2}\right )} - \frac {a c e h - b^{2} e h + b c d h + b c e g - c^{2} d g - c^{2} e f}{2 c^{3}}\right ) \log {\left (x + \frac {2 a^{2} c e h - a b^{2} e h + a b c d h + a b c e g + 4 a c^{3} \left (- \frac {\sqrt {- 4 a c + b^{2}} \left (3 a b c e h - 2 a c^{2} d h - 2 a c^{2} e g - b^{3} e h + b^{2} c d h + b^{2} c e g - b c^{2} d g - b c^{2} e f + 2 c^{3} d f\right )}{2 c^{3} \left (4 a c - b^{2}\right )} - \frac {a c e h - b^{2} e h + b c d h + b c e g - c^{2} d g - c^{2} e f}{2 c^{3}}\right ) - 2 a c^{2} d g - 2 a c^{2} e f - b^{2} c^{2} \left (- \frac {\sqrt {- 4 a c + b^{2}} \left (3 a b c e h - 2 a c^{2} d h - 2 a c^{2} e g - b^{3} e h + b^{2} c d h + b^{2} c e g - b c^{2} d g - b c^{2} e f + 2 c^{3} d f\right )}{2 c^{3} \left (4 a c - b^{2}\right )} - \frac {a c e h - b^{2} e h + b c d h + b c e g - c^{2} d g - c^{2} e f}{2 c^{3}}\right ) + b c^{2} d f}{3 a b c e h - 2 a c^{2} d h - 2 a c^{2} e g - b^{3} e h + b^{2} c d h + b^{2} c e g - b c^{2} d g - b c^{2} e f + 2 c^{3} d f} \right )} + \left (\frac {\sqrt {- 4 a c + b^{2}} \left (3 a b c e h - 2 a c^{2} d h - 2 a c^{2} e g - b^{3} e h + b^{2} c d h + b^{2} c e g - b c^{2} d g - b c^{2} e f + 2 c^{3} d f\right )}{2 c^{3} \left (4 a c - b^{2}\right )} - \frac {a c e h - b^{2} e h + b c d h + b c e g - c^{2} d g - c^{2} e f}{2 c^{3}}\right ) \log {\left (x + \frac {2 a^{2} c e h - a b^{2} e h + a b c d h + a b c e g + 4 a c^{3} \left (\frac {\sqrt {- 4 a c + b^{2}} \left (3 a b c e h - 2 a c^{2} d h - 2 a c^{2} e g - b^{3} e h + b^{2} c d h + b^{2} c e g - b c^{2} d g - b c^{2} e f + 2 c^{3} d f\right )}{2 c^{3} \left (4 a c - b^{2}\right )} - \frac {a c e h - b^{2} e h + b c d h + b c e g - c^{2} d g - c^{2} e f}{2 c^{3}}\right ) - 2 a c^{2} d g - 2 a c^{2} e f - b^{2} c^{2} \left (\frac {\sqrt {- 4 a c + b^{2}} \left (3 a b c e h - 2 a c^{2} d h - 2 a c^{2} e g - b^{3} e h + b^{2} c d h + b^{2} c e g - b c^{2} d g - b c^{2} e f + 2 c^{3} d f\right )}{2 c^{3} \left (4 a c - b^{2}\right )} - \frac {a c e h - b^{2} e h + b c d h + b c e g - c^{2} d g - c^{2} e f}{2 c^{3}}\right ) + b c^{2} d f}{3 a b c e h - 2 a c^{2} d h - 2 a c^{2} e g - b^{3} e h + b^{2} c d h + b^{2} c e g - b c^{2} d g - b c^{2} e f + 2 c^{3} d f} \right )} + \frac {e h x^{2}}{2 c} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((e*x+d)*(h*x**2+g*x+f)/(c*x**2+b*x+a),x)

[Out]

x*(-b*e*h/c**2 + d*h/c + e*g/c) + (-sqrt(-4*a*c + b**2)*(3*a*b*c*e*h - 2*a*c**2*d*h - 2*a*c**2*e*g - b**3*e*h
+ b**2*c*d*h + b**2*c*e*g - b*c**2*d*g - b*c**2*e*f + 2*c**3*d*f)/(2*c**3*(4*a*c - b**2)) - (a*c*e*h - b**2*e*
h + b*c*d*h + b*c*e*g - c**2*d*g - c**2*e*f)/(2*c**3))*log(x + (2*a**2*c*e*h - a*b**2*e*h + a*b*c*d*h + a*b*c*
e*g + 4*a*c**3*(-sqrt(-4*a*c + b**2)*(3*a*b*c*e*h - 2*a*c**2*d*h - 2*a*c**2*e*g - b**3*e*h + b**2*c*d*h + b**2
*c*e*g - b*c**2*d*g - b*c**2*e*f + 2*c**3*d*f)/(2*c**3*(4*a*c - b**2)) - (a*c*e*h - b**2*e*h + b*c*d*h + b*c*e
*g - c**2*d*g - c**2*e*f)/(2*c**3)) - 2*a*c**2*d*g - 2*a*c**2*e*f - b**2*c**2*(-sqrt(-4*a*c + b**2)*(3*a*b*c*e
*h - 2*a*c**2*d*h - 2*a*c**2*e*g - b**3*e*h + b**2*c*d*h + b**2*c*e*g - b*c**2*d*g - b*c**2*e*f + 2*c**3*d*f)/
(2*c**3*(4*a*c - b**2)) - (a*c*e*h - b**2*e*h + b*c*d*h + b*c*e*g - c**2*d*g - c**2*e*f)/(2*c**3)) + b*c**2*d*
f)/(3*a*b*c*e*h - 2*a*c**2*d*h - 2*a*c**2*e*g - b**3*e*h + b**2*c*d*h + b**2*c*e*g - b*c**2*d*g - b*c**2*e*f +
 2*c**3*d*f)) + (sqrt(-4*a*c + b**2)*(3*a*b*c*e*h - 2*a*c**2*d*h - 2*a*c**2*e*g - b**3*e*h + b**2*c*d*h + b**2
*c*e*g - b*c**2*d*g - b*c**2*e*f + 2*c**3*d*f)/(2*c**3*(4*a*c - b**2)) - (a*c*e*h - b**2*e*h + b*c*d*h + b*c*e
*g - c**2*d*g - c**2*e*f)/(2*c**3))*log(x + (2*a**2*c*e*h - a*b**2*e*h + a*b*c*d*h + a*b*c*e*g + 4*a*c**3*(sqr
t(-4*a*c + b**2)*(3*a*b*c*e*h - 2*a*c**2*d*h - 2*a*c**2*e*g - b**3*e*h + b**2*c*d*h + b**2*c*e*g - b*c**2*d*g
- b*c**2*e*f + 2*c**3*d*f)/(2*c**3*(4*a*c - b**2)) - (a*c*e*h - b**2*e*h + b*c*d*h + b*c*e*g - c**2*d*g - c**2
*e*f)/(2*c**3)) - 2*a*c**2*d*g - 2*a*c**2*e*f - b**2*c**2*(sqrt(-4*a*c + b**2)*(3*a*b*c*e*h - 2*a*c**2*d*h - 2
*a*c**2*e*g - b**3*e*h + b**2*c*d*h + b**2*c*e*g - b*c**2*d*g - b*c**2*e*f + 2*c**3*d*f)/(2*c**3*(4*a*c - b**2
)) - (a*c*e*h - b**2*e*h + b*c*d*h + b*c*e*g - c**2*d*g - c**2*e*f)/(2*c**3)) + b*c**2*d*f)/(3*a*b*c*e*h - 2*a
*c**2*d*h - 2*a*c**2*e*g - b**3*e*h + b**2*c*d*h + b**2*c*e*g - b*c**2*d*g - b*c**2*e*f + 2*c**3*d*f)) + e*h*x
**2/(2*c)

________________________________________________________________________________________